//index.js
//获取应用实例
var app = getApp()
var flag = true;
var color = "window"
Page({
  data: {
    motto: 'Hello World',
    userInfo: {},
    color : "window"
  },
  //事件处理函数
  bindViewTap: function() {
    wx.navigateTo({
      url: '../logs/logs'
    })
  },

  click:function(){
    console.log("点击了文字");
    if(flag){
      color = "window-red";
      flag = false;
    }else{
      color = "window";
      flag = true;
    }
    this.setData({
      color
    });
  },

  onLoad: function () {
    console.log('onLoad')
    var that = this
    //调用应用实例的方法获取全局数据
    app.getUserInfo(function(userInfo){
      //更新数据
      that.setData({
        userInfo:userInfo
      })
    })
  }
})
